<include file="public@header" />
</head>
<body>
	<div class="wrap">
		<ul class="nav nav-tabs">
		 	<li ><a href="{:url('InfoSchool/index')}">学校主页配置表</a></li>
        	<li class="active"><a href="">新建更新</a></li>
        </ul>
		<form method="post" class="form-horizontal js-ajax-form margin-top-20" action="{:url('InfoSchool/toAdd')}">
			
			<div class="form-group">
				<label for="input-name" class="col-sm-2 control-label">生效时间</label>
				<div class="col-md-6 col-sm-6">
					 <input class="form-control js-bootstrap-date" type="text" name="post[begin_time]"
                                   value="{:date('Y-m-d',time())}">
				</div>
			</div>
			<div class="form-group">
				<label for="input-name" class="col-sm-2 control-label">更新摘要<span class="form-required">*</span></label>
				<div class="col-md-6 col-sm-6">
					<input type="text" class="form-control"  required name="post[title]" >
				</div>
			</div>
			<div class="form-group">
				<label for="input-name" class="col-sm-2 control-label">页面代码<span class="form-required">*</span></label>
				<div class="col-md-6 col-sm-6">
					<textarea class="form-control content" name="post[content]" style="height: 600px;width: 100%;"
                                      placeholder="请填页面代码" required></textarea>
				</div>
			</div>
			
				
			<div class="form-group button-a">
				<div class="col-sm-offset-2 col-sm-10">
					<button type="submit" class="btn btn-primary js-ajax-submit">上传</button>
					<a class="btn btn-default" href="javascript:look()">预览</a>
				</div>
			</div>
		</form>
	</div>
	<script src="__STATIC__/js/frontend.js"></script>
	<script type="text/javascript">
		function look(){
			var content = $('.content').val();
			if(content == ''){
				alert('页面代码不能为空');
				return false;
			}
			$.post('addContent',{content:content},function(data){
				if (data.code == 1) {
					window.open('http://'+window.location.host+"/admin/info_school/look/id/"+data.data); 
				}
				
			});
			
		}
	</script>
</body>
</html>